import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.BasicStroke;
import java.awt.geom.*;

/**
 * Class for the Link between the two ships.
 * 
 * @author ggere
 */

public class Link extends Actor {
	
	private Player player1;
	private Player player2;

	/**
	 * Constructor, initializes the sprite and two ship references.
	 * @param anim
	 */
	Link (Animation anim, Player player1, Player player2) {
		super(anim);
		
		this.player1 = player1;
		this.player2 = player2;
	}
	
	public void draw(Graphics g) {
		Graphics2D g2 = (Graphics2D) g;
		int x1 = player1.x + player1.getHeight() / 2;
		int y1 = player1.y + player1.getWidth() / 2;
		int x2 = player2.x + player2.getHeight() / 2;
		int y2 = player2.y + player2.getWidth() / 2;
		
		g2.setStroke(new BasicStroke(2));
		g2.setColor(Color.yellow);
		g2.draw(new Line2D.Double(x1, y1, x2, y2) );
	}
}
